package Feb_10.Task;

import java.io.*;

public class Task1 {
    public static void main(String[] args) {
        File file = new File("E:/Test");
        if (file.mkdirs()){
            System.out.println("创建成功");
        }else {
            System.out.println("已存在");
        }
        try (FileInputStream fileInputStream = new FileInputStream("E:\\test.txt");
             InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream);
             BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
             FileOutputStream fileOutputStream = new FileOutputStream("E:\\Test\\test.txt");
             OutputStreamWriter outputStreamWriter = new OutputStreamWriter(fileOutputStream);
             BufferedWriter bufferedWriter = new BufferedWriter(outputStreamWriter)){
            String str;
            while ((str = bufferedReader.readLine())!=null){
                bufferedWriter.write(str);
                bufferedWriter.flush();
            }
            System.out.println("已复制");
        } catch (IOException e) {
            e.printStackTrace();
        }

    }
}
